﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace _220105BookSys.Model
{
    public class BookSysDbContext : DbContext
    {
        public BookSysDbContext(DbContextOptions options) : base(options)
        {
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            
            modelBuilder.Entity<BookType>().HasData(new BookType[]
            {
                new BookType(){Id=new Guid("5F296959-E18B-5C2B-363D-33FD96CE191D"),Name="调试分类1"},
                new BookType(){Id=new Guid("F3FA321A-6ADF-6B8E-FD62-E5C5BDAE4CD7"),Name="调试分类2"},
                new BookType(){Id=new Guid("ED1FB7B2-2D12-DC71-0339-AE5573389353"),Name="调试分类3"}
            });
            modelBuilder.Entity<Book>().HasData(new Book[]
            {
                    new Book(){Id=new Guid("0C2E67C6-71CE-4396-E428-8C4E5D4CC8EE"),Name="调试图书1",BookTypeId=Guid.Parse("5F296959-E18B-5C2B-363D-33FD96CE191D"),Describe="调试图书1简介"},
                    new Book(){Id=new Guid("8CD3C781-5D05-49FD-442E-F681E690EE7B"),Name="调试图书2",BookTypeId=Guid.Parse("5F296959-E18B-5C2B-363D-33FD96CE191D"),Describe="调试图书2简介"},
                    new Book(){Id=new Guid("7BA9BEF5-D45A-F3E8-C968-DC2DB1B23825"),Name="调试图书3",BookTypeId=Guid.Parse("5F296959-E18B-5C2B-363D-33FD96CE191D"),Describe="调试图书3简介"},
                    new Book(){Id=new Guid("386ED8BD-8283-ADBD-806B-CC9C9D7799E7"),Name="调试图书4",BookTypeId=Guid.Parse("5F296959-E18B-5C2B-363D-33FD96CE191D"),Describe="调试图书4简介"},
                    new Book(){Id=new Guid("D3A9817E-F927-9AE9-83AF-959B44ECCCE7"),Name="调试图书5",BookTypeId=Guid.Parse("5F296959-E18B-5C2B-363D-33FD96CE191D"),Describe="调试图书5简介"},
                    new Book(){Id=new Guid("C8F6A8FD-1CBB-D9A3-F6C1-7D8F4BDCEC3B"),Name="调试图书6",BookTypeId=Guid.Parse("5F296959-E18B-5C2B-363D-33FD96CE191D"),Describe="调试图书6简介"},
                    new Book(){Id=new Guid("5EB15104-3FFB-5687-04A9-DA732FBC09EB"),Name="调试图书6",BookTypeId=Guid.Parse("F3FA321A-6ADF-6B8E-FD62-E5C5BDAE4CD7"),Describe="调试图书6简介"},
                    new Book(){Id=new Guid("6FD743EF-9918-FB60-65FC-9727F7638BCF"),Name="调试图书7",BookTypeId=Guid.Parse("F3FA321A-6ADF-6B8E-FD62-E5C5BDAE4CD7"),Describe="调试图书7简介"},
                    new Book(){Id=new Guid("76D35037-99ED-4F39-8D4F-AD632A534C61"),Name="调试图书8",BookTypeId=Guid.Parse("F3FA321A-6ADF-6B8E-FD62-E5C5BDAE4CD7"),Describe="调试图书8简介"},
                    new Book(){Id=new Guid("06510EE7-6882-1C14-E33D-14866980DEAE"),Name="调试图书9",BookTypeId=Guid.Parse("F3FA321A-6ADF-6B8E-FD62-E5C5BDAE4CD7"),Describe="调试图书9简介"},
                    new Book(){Id=new Guid("F70477FE-2692-573C-831B-72F4B41098EB"),Name="调试图书10",BookTypeId=Guid.Parse("F3FA321A-6ADF-6B8E-FD62-E5C5BDAE4CD7"),Describe="调试图书10简介"},
                    new Book(){Id=new Guid("C415FBB4-62AC-F77E-E9B0-C85390F14706"),Name="调试图书11",BookTypeId=Guid.Parse("F3FA321A-6ADF-6B8E-FD62-E5C5BDAE4CD7"),Describe="调试图书11简介"},
                    new Book(){Id=new Guid("BD36EBBC-BFCF-15C5-A8A0-0561DF9C0E1A"),Name="调试图书12",BookTypeId=Guid.Parse("ED1FB7B2-2D12-DC71-0339-AE5573389353"),Describe="调试图书12简介"},
                    new Book(){Id=new Guid("9590623E-FD76-668B-9210-84E403B8256A"),Name="调试图书13",BookTypeId=Guid.Parse("ED1FB7B2-2D12-DC71-0339-AE5573389353"),Describe="调试图书13简介"},
                    new Book(){Id=new Guid("D77C7396-B76C-4D78-4CEB-77A3CEFC28EC"),Name="调试图书14",BookTypeId=Guid.Parse("ED1FB7B2-2D12-DC71-0339-AE5573389353"),Describe="调试图书14简介"},
                    new Book(){Id=new Guid("2E1EBB02-F968-CC6D-36C4-4DFA6690C8A8"),Name="调试图书15",BookTypeId=Guid.Parse("ED1FB7B2-2D12-DC71-0339-AE5573389353"),Describe="调试图书15简介"},
                    new Book(){Id=new Guid("68C0E8ED-BB42-F4BC-4B5F-FFB564F9476D"),Name="调试图书16",BookTypeId=Guid.Parse("ED1FB7B2-2D12-DC71-0339-AE5573389353"),Describe="调试图书16简介"},
                    new Book(){Id=new Guid("8AE32FFD-9F8A-D813-8CA8-D9906126DD05"),Name="调试图书17",BookTypeId=Guid.Parse("ED1FB7B2-2D12-DC71-0339-AE5573389353"),Describe="调试图书17简介"}
            });
        }

        public DbSet<Book> Books { get; set; }
        public DbSet<BookType> BookTypes { get; set; }
    }
}
